<?php

class editAction extends rareAction {

    public function execute() {
        $id = $this->getGetParam('id', 0);
        if ($id == 0 || $id == 1) {
            forward('manager');
        }
        $dao = new DaoAdmin();
        $user = $dao->getOne(" id='{$id}'");
        $this->assign('user', $user);
    }

    public function executePost() {
        $id = $this->getPostParam('id', 0);
        if ($id == 0 || $id == 1)
            
            jsonReturn(0, '参数错误');
        $passwd1 = $this->getPostParam('passwd1', '');
        $passwd2 = $this->getPostParam('passwd2', '');
//        echo $passwd1;
//        echo $passwd2;
//        exit;
        if ($passwd1 == $passwd2 && $passwd1 != '' && $passwd2 != '') {
            $dao = new DaoAdmin();
            $dao->update("id='{$id}'", array('password' => md5($passwd1)));
            jsonReturn(1, 'ok');
        }
        jsonReturn(0, '请重新操作');
    }

}

?>
